<template>
  <div class="index_box">
    <div>
      <div class="top">
        <span> 爱课</span
        ><span class="right"
          ><img src="@\assets\image\icon\icon_0.png" alt=""
        /></span>
      </div>
      <!-- <van-button type="primary" size="large">大号按钮</van-button> -->
      <div class="logo">
        <img @click="handleclick" src="@\assets\image\index_0.png" alt="" />
      </div>
      <div class="course">
        <img src="@\assets\image\icon\i_hot.png" alt="" /><span>推荐课程</span>
      </div>
      <div class="cent_box">
        <p class="one">五天哈佛外教体验营</p>
        <p class="two">每天25分钟，认识75%的单词</p>
        <span>每日限量100</span>
        <p class="for">0元领取</p>
      </div>
      <div class="read">
        <img src="@\assets\image\icon\i_book.png" alt="" /><span>推荐阅读</span>
      </div>
      <div class="reading">
        <ul>
          <li v-for="item in list" :key="item.title">
            <img :src="item.url" alt="" />
            <div class="right">
              <p>{{ item.name }}</p>
              <p>{{ item.title }}</p>
              <span>育儿启示</span>
            </div>
          </li>
        </ul>
      </div>
      <div class="like">
        <img src="@\assets\image\icon\i_video.png" alt="" /><span
          >爱课介绍</span
        >
        <ul>
          <li><img src="@\assets\image\index_1.png" alt="" /></li>

          <li><img src="@\assets\image\index_2.png" alt="" /></li>
          <li><img src="@\assets\image\index_3.png" alt="" /></li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
// import IndexList from "../../components/home/IndexList.vue";
import BScroll from "@better-scroll/core";
import { IndexApi } from "../../utils/api";

export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    this.gitIndex();
  },
  methods: {
    handleclick() {
      console.log(1);
      this.$router.push("/Harvard");
    },
    async gitIndex() {
      const res = await IndexApi();
      this.list = res.data.list;
      await this.$nextTick();
      new BScroll(".index_box", {
        scrollY: true,
        scrollX: false,
        click: true,
      });
    },
  },
};
</script>

<style lang="less" scoped>
@import "../../assets/css/var.less";
.index_box {
  background-color: white;
  height: 660px;
  overflow: hidden;
}
.top {
  height: 50px;
  .both ();
  padding: 10px;

  span {
    font-size: 22px;
    // line-height: 50px;
  }
  .right {
    display: block;
    background: pink;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    .center ();
    img {
      width: 80%;
      height: auto;
    }
  }
}
.logo {
  width: 100%;

  img {
    width: 100%;
    height: auto;
    padding-bottom: 20px;
    // box-shadow: 2px 1px 4px -1px #ccc;
  }
}
.course img {
  width: 30px;
  padding: 0 5px;
}

.course span {
  font-size: 25px;
  line-height: 30px;
}
.cent_box {
  border: 1px solid #ccc;
  border-radius: 25px;
  margin: 10px;
  .one {
    font-size: 22px;
    line-height: 40px;
  }
  .two {
    color: #737373;
  }
  span {
    font-size: 16px;
    color: red;
    border: 1px solid #f9dde0;
    margin-left: 10px;
    background: #eec2c4;
  }
  .for {
    border-radius: 25px;
    background: #ea534c;
    color: #f9dbdb;
    text-align: center;
    line-height: 30px;
    height: 30px;
    font-weight: 999;

    margin: 20px 10px 15px 20px;
  }
  p {
    font-size: 16px;
    margin-left: 10px;
  }
}
.read img {
  width: 30px;
  padding: 0 5px;
}
.read span {
  font-size: 25px;
  line-height: 30px;
}
.reading {
  border: 1px solid #ccc;
  box-shadow: 2px 1px 4px -1px #ccc;
  border-radius: 25px;
  margin: 15px;
  li {
    display: flex;
    padding: 15px;
    border-bottom: 1px dashed #686868;
    margin: 10px;
    img {
      height: 90px;
      width: 100px;
    }
  }
  .right p {
    margin-left: 15px;
  }
  .right p:nth-child(1) {
    font-size: 16px;
    font-weight: 666;
  }
  .right p:nth-child(2) {
    font-size: 14px;
    margin-top: 10px;
  }
  .right span {
    font-size: 18px;
    color: #3ce0ff;
    margin-left: 120px;
    display: block;
    background: #e8fcff;
    text-align: center;
    // font-weight: 666;
  }
}
.like {
  padding-bottom: 75px;
  span {
    font-size: 25px;
    line-height: 30px;
  }
  img {
    width: 30px;
    padding: 0 5px;
  }
}
.like ul {
  display: flex;
  justify-content: space-around;
  img {
    width: 120px;
  }
}
</style>
